package com.my.study.hutool.aop;

import cn.hutool.aop.ProxyUtil;
import com.my.study.hutool.aop.cglib.Dog;
import com.my.study.hutool.aop.cglib.DogAspect;
import com.my.study.hutool.aop.spring.UserAspect;
import com.my.study.hutool.aop.spring.UserServiceImpl;

/**
 * @author: yidujun
 * @create: 2021/06/28 13:56
 */
public class AopTest {

    public static void main(String[] args) {
        testSpringCglib();

        testCglib();
    }

    private static void testCglib() {
        Dog proxy = ProxyUtil.proxy(new Dog(), DogAspect.class);
        proxy.eat();
    }

    private static void testSpringCglib() {
        UserServiceImpl proxy = ProxyUtil.proxy(new UserServiceImpl(), UserAspect.class);
        String userName = proxy.getUserName();
        System.out.println(userName);
    }


}
